#include<iostream>
#include<map>

using namespace std;

map<int,map<int,int>> a;

int main(int argc, char const *argv[])
{
    int n,q,i,j,k,cmd;
    scanf("%d %d",&n,&q);
    while (q--)
    {
       scanf("%d %d %d",&cmd, &i,&j);
       if (cmd == 1)
       {
           scanf("%d",&k);
           a[i][j]=k;
       }else{
           printf("%d\n",a[i][j]);
       }
       
    }
    
    

    return 0;
}
